package main

import (
	"log"

	"time"

	"github.com/robfig/cron"
)

func demo() {
	log.Println("Run models.CleanAllTag...")
}

func Task(sep string, f func()) {
	log.Println("Starting...")

	c := cron.New()
	c.AddFunc(sep, f)

	c.Start()

	t1 := time.NewTimer(time.Second * 100)
	for {
		select {
		case <-t1.C:
			t1.Reset(time.Second * 100)
		}
	}
}

func main() {
	Task("* * * * * *", demo)
}
